﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ControlAccessUser.Model;

namespace ControlAccessUser.Presenter
{
    
    public class PresenterUserRegister
    {
        IUserRegisterView view;
        public PresenterUserRegister(IUserRegisterView View)
        {
            view = View;
        }

        public void RegisterUser()
        {
            try
            {
                Model.User User = new Model.User()
                {
                    UserFirstName = view.UserLastName,
                    UserLastName = view.UserLastName,
                    UserName = view.UserName,
                    UserPassword = view.UserPassword
                };

                ControlAccessUser.Bussiness.ManagerUser.RegisterUser(User);
                view.SystemMessage = Message.RegisterSuccessfully;
                
            }
            catch (Exception err)
            {

                view.ErrorMessage = err.Message;
            }
        }
    }
}
